<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
  <link rel="stylesheet prefetch" href="/static/web/css/bootstrap.min.css">
  <link rel="stylesheet" href="/static/web/css/style.css">
  <title>报名提交</title>
  <script src="/static/web/js/jquery.min.js"></script>

</head>

<body aos-easing="ease" aos-duration="1000" aos-delay="0" style="">
  <!--手机导航-->
  {include file="public/header" /}

  <div class="gtrt5h2"></div>
  <div class="bodyy">
    <!--境外劳务-->
    <div class="itg4v aos-init aos-animate" aos="fade-down"><img src="/static/web/img/bd.jpg" class="img-responsive center-block aos-init aos-animate"
        width="100%" aos="fade-down"></div>
    <div class="jytj76i2">
      <script type="text/javascript">
        function validate_required(field, alerttxt) {
          with(field) {
            if (value == null || value == "") {
              alert(alerttxt);
              return false
            } else {
              return true
            }
          }
        }
        function validate_form(thisform) {
          with(thisform) {
            if (validate_required(address, "请填写现居地！") == false) {
              address.focus();
              return false
            }
            if (validate_required(contact_num, "请填写电话号码！") == false) {
              contact_num.focus();
              return false
            }
          }
        }
      </script>
      <form name="form1" method="post" id="form_ajax" onsubmit="return false;">
        <div class="bdt1 aos-init" aos="fade-down">
          <input type="text" class="form-control"  name="name" id="name" placeholder="您的姓名">
        </div>
        <div class="bdt1 aos-init" aos="fade-down">
          <span class="xh1">*</span>
          <input type="text" class="form-control" name="tel" id="tel" placeholder="您的手机号">
        </div>
        <div class="bdt1 aos-init" aos="fade-down">
          <span class="xh1">*</span>
          <input type="text" class="form-control" name="address" placeholder="所在地" id="firstname">
        </div>
        <div class="bdt1 aos-init" aos="fade-down">
          <input type="text" class="form-control" name="state" id="lastname" placeholder="目标国家">
        </div>
        <div style="display:none"></div>
        <script type="text/javascript">
          var nowDate = new Date();
          var str = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate() + " " + nowDate.getHours() +
            ":" + nowDate.getMinutes() + ":" + nowDate.getSeconds();
          document.getElementById("time").value = str;
        </script>
        <div class="bdt1 aos-init" aos="fade-down">
          <button type="submit" onclick="submitForm()" class="anniuyang btn tjbd1">提交报名材料</button>
        </div>
        <div class="clear"></div>
      </form>
    </div>

    <script src="/static/web/js/wap-nav.js"></script>
    <script src="/static/common/layer/layer.js"></script>
    <script>  
      function submitForm(){
        var formData = $('#form_ajax').serialize();
        var name = $('#name').val();
        var tel = $('#tel').val();
        if(name == ''){
          layer.alert('姓名不能为空', {icon: 5});
        } else if(tel == '') {
          layer.alert('电话不能为空', {icon: 5});
        } else {
          $.ajax({
            url:"{:url('admin/user/add')}",
            type:"post",
            data:formData,
            success:function(data){
              if(data.code == 1){
                layer.alert(data.msg, {icon: 6});
                $("form")[0].reset();
              }else{
                layer.alert(data.msg, {icon: 5});
              }
            }
          })
        }
      }
    </script>
  </div>
</body>
</html>